/*
 * Copyright 2006 Matt Jensen
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
 * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations under the License.
 */
package org.spectaql.examples.entity;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import javax.persistence.*;
import java.util.Set;

/**
 * <p>
 * <code>Airplane</code> is ...
 * </p>
 */
@Entity
@Table(name = "AIRPLANE")
public class Airplane
{
    private static Log LOG = LogFactory.getLog(Airplane.class);

    @Id
    @Column(name = "AIRPLANE_ID")
    private Long id;

    @OneToOne
    private Person pilot;

    @ManyToMany
    @JoinTable(
            name = "PASSENGER",
            joinColumns = { @JoinColumn(name = "AIRPLANE_ID") },
            inverseJoinColumns = { @JoinColumn(name = "PERSON_ID") }
    )
    private Set<Person> passengers;

    @Basic
    @Column(name = "EMPTY_WEIGHT")
    private int emptyWeight;

    @Basic
    @Column(name = "MAX_WEIGHT")
    private int maxWeight;

    @Basic
    private String model;

    @Basic
    private String registration;

    @Basic
    private int seating;
    
    /**
     * <p>
     * Construct a {@link Airplane} instance.
     * </p>
     */
    public Airplane()
    {
        super();
    }

    public Long getId()
    {
        return id;
    }

    public int getEmptyWeight()
    {
        return emptyWeight;
    }

    public int getMaxWeight()
    {
        return maxWeight;
    }

    public String getModel()
    {
        return model;
    }

    public String getRegistration()
    {
        return registration;
    }

    public int getSeating()
    {
        return seating;
    }

    public void setSeating(int seating)
    {
        this.seating = seating;
    }

    public Person getPilot()
    {
        return pilot;
    }

    public Set<Person> getPassengers()
    {
        return passengers;
    }

    public void setPassengers(Set<Person> passengers)
    {
        this.passengers = passengers;
    }
}
